import Vue from 'vue'


/**权限指令**/
Vue.directive('has', {
  bind: function (el, binding) {
    if (!Vue.prototype.$_has(binding.value)) {
      // el.parentNode.removeChild(el);
      el.style.display = 'none';
    }
  }
});


Vue.prototype.$_has = function (val) {
  let isShow = false;
  let btnPowerArr = localStorage.getItem('perms');
  if(btnPowerArr==undefined || btnPowerArr==null){
    return false;
  }
  if(btnPowerArr.indexOf(val) > -1){
    isShow = true;
  }
  return isShow;
}
